Switch from mypy to ty for type checking#418
Draft
stefanvanburen wants to merge 1 commit intomainfrom
Draft
Conversation
stefanvanburen
commented
Jan 16, 2026
Comment on lines
+418
to
+419
| def validate(self, ctx: RuleContext, message: message.Message): | ||
| num_set_fields = sum(1 for field in self._fields if not _is_empty_field(message, field)) |
Member
Author
There was a problem hiding this comment.
ty wants the names of the arguments to match when over-riding from a superclass.
stefanvanburen
commented
Jan 16, 2026
Comment on lines
+620
to
+626
| def validate_item(self, ctx: RuleContext, value: typing.Any, *, for_key: bool = False): | ||
| self._validate_value(ctx, value, for_key=for_key) | ||
| self._validate_cel( | ||
| ctx, this_value=value, this_cel=_scalar_field_value_to_cel(value, self._field), for_key=for_key | ||
| ) | ||
|
|
||
| def _validate_value(self, ctx: RuleContext, val: typing.Any, *, for_key: bool = False): | ||
| def _validate_value(self, ctx: RuleContext, value: typing.Any, *, for_key: bool = False): |
Member
Author
There was a problem hiding this comment.
renamed to value here
Contributor
|
I tried using it on protobuf-python (which now uses pyright), it produced a lot of false positive. I also see many issues on github, apparently it's not always completely deterministic, can crash in certain circonstances, etc |
Member
Author
|
@AdrienVannson Fair! I'm happy to wait for a release beyond |
Member
Author
|
(Going to just park this in draft for now.) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tyis iterating rapidly, but already seems better thanmypy.